<script setup>
// 子组件
// 借助编译器宏完成配置props
const props = defineProps({
    car:String,
    money:Number
})
console.log(props.car);
console.log(props.money);

const emit = defineEmits(['changeMoney'])

const buy = () => {
    emit('changeMoney',5)
}


</script>

<template>
    <div class="son"> 我是子组件 - {{car}} - {{money}}
        <button @click="buy">花钱</button>
    </div>
</template>

<style scoped>
.son {
    border: 1px solid #000;
    padding: 30px;
    text-align: center;
}
</style>
